package com.ruoyi.miniapp.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.miniapp.domain.MiniOrder;
import com.ruoyi.miniapp.mapper.MiniOrderMapper;
import com.ruoyi.miniapp.service.IMiniOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 订单Service业务层处理
 * 
 * @author duantao
 * @date 2025-10-10
 */
@Service
public class MiniOrderServiceImpl implements IMiniOrderService
{
    @Autowired
    private MiniOrderMapper miniOrderMapper;

    /**
     * 查询订单
     * 
     * @param id 订单主键
     * @return 订单
     */
    @Override
    public MiniOrder selectMiniOrderById(Long id)
    {
        return miniOrderMapper.selectMiniOrderById(id);
    }

    /**
     * 查询订单列表
     * 
     * @param miniOrder 订单
     * @return 订单
     */
    @Override
    public List<MiniOrder> selectMiniOrderList(MiniOrder miniOrder)
    {
        return miniOrderMapper.selectMiniOrderList(miniOrder);
    }

    /**
     * 新增订单
     * 
     * @param miniOrder 订单
     * @return 结果
     */
    @Override
    public int insertMiniOrder(MiniOrder miniOrder)
    {
        miniOrder.setCreateTime(DateUtils.getNowDate());
        return miniOrderMapper.insertMiniOrder(miniOrder);
    }

    /**
     * 修改订单
     * 
     * @param miniOrder 订单
     * @return 结果
     */
    @Override
    public int updateMiniOrder(MiniOrder miniOrder)
    {
        miniOrder.setUpdateTime(DateUtils.getNowDate());
        return miniOrderMapper.updateMiniOrder(miniOrder);
    }

    /**
     * 批量删除订单
     * 
     * @param ids 需要删除的订单主键
     * @return 结果
     */
    @Override
    public int deleteMiniOrderByIds(Long[] ids)
    {
        return miniOrderMapper.deleteMiniOrderByIds(ids);
    }

    /**
     * 删除订单信息
     * 
     * @param id 订单主键
     * @return 结果
     */
    @Override
    public int deleteMiniOrderById(Long id)
    {
        return miniOrderMapper.deleteMiniOrderById(id);
    }
}
